//
//  MenuLayer.m
//  Hock
//
//  Created by orta on 22/08/2008.
//  Copyright 2008 __MyCompanyName__. All rights reserved.
//

#import "MenuLayer.h"

@implementation MenuLayer

-(id) init {
	[super init];
	
	[MenuItem setFontSize:30];
	[MenuItem setFontName: @"Helvetica"];
	MenuItem *item1 = [MenuItem itemFromString: @"Best of 5" receiver:self selector:@selector(menuCallStart5)];
  MenuItem *item2 = [MenuItem itemFromString: @"Best of 9" receiver:self selector:@selector(menuCallStart9)];
	MenuItem *item3 = [MenuItem itemFromString: @"Best of 15" receiver:self selector:@selector(menuCallStart15)];
	MenuItem *item4 = [MenuItem itemFromString: @"Options" receiver:self selector:@selector(menuCallback2)];
	//[[item3 label] setR:255 g:0 b:32];
	
	[Menu setOffsetY:-40];
	menu = [Menu menuWithItems: item1, item2, item3, item4, nil];
	
	[self add: menu];
	isTouchEnabled = YES;
  return self;
}

-(void) menuCallStart5{
	Scene *scene = [Scene node];
	[scene add: [GameLayer node] z:0];
  [[Director sharedDirector] replaceScene:scene];
  bestOutOfInt = 3;
}
-(void) menuCallStart9{
  
	Scene *scene = [Scene node];
	[scene add: [GameLayer node] z:0];
  [[Director sharedDirector] replaceScene:scene];
  bestOutOfInt = 5;
}

-(void) menuCallStart15{
	Scene *scene = [Scene node];
	[scene add: [GameLayer node] z:0];
  [[Director sharedDirector] replaceScene:scene];
  bestOutOfInt = 7;
}


-(void) menuCallback2{
}

-(void) onQuit{
	[[Director sharedDirector] end];
}

@end
